class P490 {

	public static void main(String[] args) {

		char[][] matrix = new char[100][100];

		int maxLine = 0;

		String line = readLn();
		int lineNumber = 0;
		while (line != null) {

			if (line.length() > maxLine)
				maxLine = line.length();

			for (int k = 0; k < line.length(); k++) {
				matrix[lineNumber][k] = line.charAt(k);
			}

			line = readLn();
			lineNumber++;
		}

		fill(matrix, lineNumber, maxLine);

		print(matrix, maxLine);

		// System.out.println();
	}

	private static void fill(char[][] matrix, int lineNumber, int maxLine) {
		for (int k = 0; k < lineNumber; k++) {
			for (int j = 0; j < maxLine; j++) {
				if (matrix[k][j] == (char) 0)
					matrix[k][j] = ' ';
			}
		}

	}

	public static void print(char[][] matrix, int maxLine) {
		for (int k = 0; k < matrix.length; k++) {
			for (int j = matrix[k].length - 1; j >= 0; j--) {
				System.out.print(matrix[j][k]);
			}
			if (k < maxLine) {
				System.out.println();
			}
		}
	}

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString());
	}

}